﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace wfaFoxMigrator
{
    public partial class frmCurrentlyProcessing : Form
    {
        public bool CancelPressed = false;
        public delegate void PressCancel();
        public event PressCancel OnPressCancel;
        public frmCurrentlyProcessing()
        {
            InitializeComponent();
        }

        private void frmCurrentlyProcessing_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(Properties.Settings.Default.AreYouSureOfCancelMigration, "Caution", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                evtPressCancel();
                CancelPressed = true;
                Application.DoEvents();
            }            
        }
        protected void evtPressCancel()
        {
            if (OnPressCancel != null)
            {
                OnPressCancel();
            }
            Application.DoEvents();
        }
    }
}
